package com.shujia.wyh.day07.ketang;

/*
    protected Object clone() 是浅拷贝
 */
public class ObjectDemo3 {
    public static void main(String[] args) {
        //创建一个教师对象
//        Teacher t1 = new Teacher("小虎", 18);
//        Teacher clone = t1.clone();
//        System.out.println(t1);
//        System.out.println(clone);
//        System.out.println(t1==clone);

        //创建一个教师对象
        Phone p1 = new Phone("Iphone14 pro", 6999);

        Teacher t1 = new Teacher("小虎", 18, p1);
        System.out.println(t1);

        Teacher cloneT1 = t1.clone();
        System.out.println(t1);
        System.out.println(cloneT1);
        System.out.println(t1.getPhone()==cloneT1.getPhone());
    }
}
